package xcmg.device.infra.enums;

public enum AgentApplyStatusEnum {
                        //是否可     删除、  修改、  初审、  终审、  撤回
  DRAFT(              1, "草拟",     true,  true,  false, false, false),
  WAIT_AUDIT(         2, "待初审",   true,  false, true,  false, true),
  FIRST_AUDIT_PASSED( 3, "初审通过", false, false, false, true,  false),
  FINAL_AUDIT_PASSED( 4, "终审通过", false, false, false, false, false),
  RETURN_UPDATE(      5, "返回修改", true,  true,  false, false, false),
  FINISH(             6, "已完结",   false, false, false, false, false);

  private Integer status;

  private String desc;

  /**
   * 是否可删除
   */
  private boolean canDelete;

  /**
   * 是否可修改
   */
  private boolean canUpdate;

  /**
   * 是否可初审
   */
  private boolean canFirstAudit;

  /**
   * 是否可终审
   */
  private boolean canFinalAudit;

  /**
   * 是否可撤回
   */
  private boolean canRevoke;

  /**
   * 根据状态码获取枚举实例
   *
   * @param status
   */
  public static AgentApplyStatusEnum getByStatus(Integer status) {
    for (AgentApplyStatusEnum statusEnum : AgentApplyStatusEnum.values()) {
      if (statusEnum.getStatus().equals(status)) {
        return statusEnum;
      }
    }
    return null;
  }

  AgentApplyStatusEnum(Integer status, String desc, boolean canDelete, boolean canUpdate,
      boolean canFirstAudit, boolean canFinalAudit, boolean canRevoke) {
    this.status = status;
    this.desc = desc;
    this.canDelete = canDelete;
    this.canUpdate = canUpdate;
    this.canFirstAudit = canFirstAudit;
    this.canFinalAudit = canFinalAudit;
    this.canRevoke = canRevoke;
  }

  public Integer getStatus() {
    return status;
  }

  public void setStatus(Integer status) {
    this.status = status;
  }

  public String getDesc() {
    return desc;
  }

  public void setDesc(String desc) {
    this.desc = desc;
  }

  public boolean isCanDelete() {
    return canDelete;
  }

  public void setCanDelete(boolean canDelete) {
    this.canDelete = canDelete;
  }

  public boolean isCanUpdate() {
    return canUpdate;
  }

  public void setCanUpdate(boolean canUpdate) {
    this.canUpdate = canUpdate;
  }

  public boolean isCanFirstAudit() {
    return canFirstAudit;
  }

  public void setCanFirstAudit(boolean canFirstAudit) {
    this.canFirstAudit = canFirstAudit;
  }

  public boolean isCanFinalAudit() {
    return canFinalAudit;
  }

  public void setCanFinalAudit(boolean canFinalAudit) {
    this.canFinalAudit = canFinalAudit;
  }

  public boolean isCanRevoke() {
    return canRevoke;
  }

  public void setCanRevoke(boolean canRevoke) {
    this.canRevoke = canRevoke;
  }
}
